home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / window4c.arc / DEMO.C next >
Text File  |  1985-02-08  |  30KB  |  926 lines

  1. #define    foreground(A)    ((color_mon==1)?(A):(7))
  2.  
  3.  
  4.     int    u_row[14]={2,2,2,2,2,8,14,20,20,20,20,20,14,8};
  5.     int    u_col[14]={6,21,36,51,66,66,66,66,51,36,21,6,6,6};
  6.     int    l_row[14]={6,6,6,6,6,12,18,24,24,24,24,24,18,12};
  7.     int    l_col[14]={15,30,45,60,75,75,75,75,60,45,30,15,15,15};
  8.     int    wind[14];
  9.  
  10.     int    color_mon=0;
  11.  
  12.  
  13. main()
  14.  
  15. {
  16.  
  17.     int    temp,key,i,j,k,l;
  18.  
  19.     color(7,0);
  20.  
  21.     temp=open_window(9,15,13,61);
  22.  
  23.     locate(11,20);printf("Do you have a color monitor (Y/N) [ ]");
  24.     locate(11,55);
  25.     putch(key=getch());
  26.     if(key=='Y' || key=='y')color_mon=1;
  27.  
  28.     close_window(temp);
  29.  
  30.     color(foreground(1),0);
  31.     temp=open_window(3,5,23,75);
  32.     color_window(temp,foreground(14),0);
  33.     cls_window(temp);
  34.     print_window(temp,"╓─────────────────────────────────────────────── ▒▒▒▒█████\n");
  35.     print_window(temp,"║                            ░░░░░░              ███████▄\n");
  36.     print_window(temp,"║    ██   █   ██             ░____               ████O████\n");
  37.     print_window(temp,"║     ██ ███ ██                   ░              ▀▀▀▀▀▀▀▀▀\n");
  38.     print_window(temp,"║      ██   ██   I N D O W   ░░░░░░   O F T        │\n");
  39.     print_window(temp,"║                                                  │\n");
  40.     print_window(temp,"╚══════════╤══════════════════════════╤════════════╛\n");
  41.     print_window(temp,"           │   Fast - Small - Easy &  │   ╔════════════════════╗\n");
  42.     print_window(temp,"           │        C H E A P         │   ║  Glen Boyd         ║\n");
  43.     print_window(temp,"     ╔═════│                          │═══╣  21606 Criptana    ║\n");
  44.     print_window(temp,"     ║     │  W I N D O W S  For  'C' │   ║  Mission Viejo, CA ║\n"); 
  45.     print_window(temp,"     ║     │                          │   ║         92692      ║\n");
  46.     print_window(temp,"     ║     ╘══════════════════════════╛   ╚══╦═════════════════╝\n");
  47.     print_window(temp,"     ║                                       ║\n");
  48.     print_window(temp,"     ║ If you use these functions and find   ║\n");
  49.     print_window(temp,"     ║ them of value, a contribution of $30  ║\n");
  50.     print_window(temp,"     ║ would be greatly appreciated.         ║\n");
  51.     print_window(temp,"     ║                                       ║\n");
  52.     print_window(temp,"     ╚═══════════════════════════════════════╝");
  53.  
  54.     key=getch();
  55.  
  56.     close_window(temp);
  57.  
  58.  
  59.     for(i=0;i<=13;i++){
  60.  
  61.         color(foreground(i+1),0);
  62.         wind[i]=open_window(u_row[i],u_col[i],l_row[i],l_col[i]);
  63.  
  64.     }
  65.  
  66.     for(i=13;i>=0;i--){
  67.  
  68.         close_window(wind[i]);
  69.  
  70.     }
  71.  
  72.     for(i=13;i>=0;i--){
  73.  
  74.         color(foreground(i+1),0);
  75.         wind[i]=open_window(u_row[i],u_col[i],l_row[i],l_col[i]);
  76.  
  77.     }
  78.  
  79.     for(i=0;i<=13;i++){
  80.  
  81.         close_window(wind[i]);
  82.  
  83.     }
  84.  
  85.     for(i=0;i<14;i++){
  86.  
  87.         color(foreground(i+1),0);
  88.         wind[i]=open_window(u_row[i],u_col[i],l_row[i],l_col[i]);
  89.         color_window(wind[i],foreground(13),0);
  90.         print_window(wind[i],"C-WINDOWC-WINDOWC-WINDOW");
  91.         color_window(wind[i],foreground(i+1),0);
  92.  
  93.     }
  94.  
  95.  
  96.  
  97.  
  98.     subject(-1);
  99.  
  100.  
  101. /*  Move box 14 into place */
  102.  
  103.     for(i=15;i<=35;i++){
  104.  
  105.         move_window(wind[13],2);
  106.         slower();
  107.  
  108.     }
  109.     close_window(wind[13]);
  110.  
  111.  
  112.     subject(13);
  113.  
  114. /* Move box 13 into place */
  115.  
  116.     for(i=14;i>=11;i--){
  117.  
  118.         move_window(wind[12],1);
  119.         slower(13);
  120.  
  121.     }
  122.  
  123.     for(i=15;i<=40;i++){
  124.  
  125.         move_window(wind[12],2);
  126.         slower();
  127.  
  128.     }
  129.     close_window(wind[12]);
  130.  
  131.     subject(12);
  132.  
  133.  
  134. /* Move box 12 into place */
  135.  
  136.     for(i=11;i>=7;i--){
  137.  
  138.         for(j=u_col[i];j>6;j--){
  139.  
  140.             move_window(wind[i],4);
  141.             slower();
  142.         }
  143.  
  144.         for(j=u_row[i];j>11;j--){
  145.  
  146.             move_window(wind[i],1);
  147.             slower();
  148.         }
  149.  
  150.         l_col[i]=11;
  151.  
  152.         for(j=l_col[i];j<=35;j++){
  153.  
  154.             move_window(wind[i],2);
  155.             slower();
  156.         }
  157.  
  158.         close_window(wind[i]);
  159.  
  160.         subject(i);
  161.  
  162.     }
  163.  
  164.     for(i=6;i>=4;i--){
  165.  
  166.         for(j=l_row[i];j<24;j++){
  167.             move_window(wind[i],3);
  168.             slower();
  169.         }
  170.         l_row[i]=24;
  171.             
  172.  
  173.         for(j=u_col[i];j>6;j--){
  174.  
  175.             move_window(wind[i],4);
  176.             slower();
  177.         }
  178.         
  179.  
  180.         for(j=l_row[i];j>15;j--){
  181.  
  182.             move_window(wind[i],1);
  183.             slower();
  184.         }
  185.  
  186.         l_col[i]=6;
  187.  
  188.         for(j=l_col[i];j<=35;j++){
  189.  
  190.             move_window(wind[i],2);
  191.             slower();
  192.         }
  193.  
  194.         close_window(wind[i]);
  195.  
  196.         subject(i);
  197.  
  198.     }
  199.  
  200.  
  201.     for(i=3;i>=0;i--){
  202.  
  203.         for(j=l_col[i];j<75;j++){
  204.  
  205.             move_window(wind[i],2);
  206.             slower();
  207.         }
  208.  
  209.         l_col[i]=75;
  210.  
  211.  
  212.         for(j=l_row[i];j<24;j++){
  213.             move_window(wind[i],3);
  214.             slower();
  215.         }
  216.         l_row[i]=24;
  217.             
  218.  
  219.         for(j=l_col[i];j>15;j--){
  220.  
  221.             move_window(wind[i],4);
  222.             slower();
  223.         }
  224.  
  225.         for(j=l_row[i];j>15;j--){
  226.  
  227.             move_window(wind[i],1);
  228.             slower();
  229.         }
  230.  
  231.         l_col[i]=11;
  232.  
  233.         for(j=l_col[i];j<=35;j++){
  234.  
  235.             move_window(wind[i],2);
  236.             slower();
  237.         }
  238.  
  239.         close_window(wind[i]);
  240.  
  241.         subject(i);
  242.  
  243.     }
  244.  
  245.     subject(-2);
  246.  
  247. }
  248.  
  249. subject(wind)
  250.  
  251. int    wind;
  252.  
  253. {
  254.  
  255. static    int    temp,
  256.         temp2;
  257.     int    key,
  258.         wind1,
  259.         wind2,
  260.         wind3,
  261.         wind4,i,j;
  262.  
  263.     char    string[100];
  264.  
  265.     switch(wind){
  266.  
  267.  
  268.         case (-1):
  269.  
  270.             color(foreground(14),0);
  271.             temp2=open_window(8,17,18,64);
  272.             color_window(temp2,foreground(2),0);
  273.             print_window(temp2," C-WINDOWS is a comprehensive screen and");
  274.             print_window(temp2,"\n window handling package.  C-WINDOWS relieves");
  275.             print_window(temp2,"\n the programmer of handling extensive screen");
  276.             print_window(temp2,"\n and window manipulation.  C-WINDOWS is a");
  277.             print_window(temp2,"\n library of pre-written 'C' and ASSEMBLY");
  278.             print_window(temp2,"\n functions which do printing, coloring,");
  279.             print_window(temp2,"\n cursor positioning, and window handling.");
  280.             locate_window(temp2,9,9);
  281.             print_window(temp2,"Press any key to continue...");
  282.             color_window(temp2,foreground(14),0);
  283.             key=getch();
  284.  
  285.             break;
  286.  
  287.         case(13):
  288.  
  289.             color(foreground(14),0);
  290.             temp=open_window(4,9,23,73);
  291.             color_window(temp,foreground(2),0);
  292.  
  293.             print_window(temp," C-WINDOWS is supplied in a MS-DOS object library.  To obtain ");
  294.             print_window(temp,"\n the source for C-WINDOWS send a $30 contribution.  \n");
  295.  
  296.             print_window(temp,"\n C-WINDOWS provides you with a extensive set  of  pre-written ");
  297.             print_window(temp,"\n functions   for   manipulation  of  the  screen.   C-WINDOWS ");
  298.             print_window(temp,"\n provides functions for handling standard screen I/O such  as ");
  299.             print_window(temp,"\n printing, locating the cursor, setting color, scrolling part ");
  300.             print_window(temp,"\n of the screen, printing boxes, saving and restoring parts of ");
  301.             print_window(temp,"\n the  screen,  and  printing  horizontal and veritcal bars of ");
  302.             print_window(temp,"\n characters. \n");
  303.  
  304.             print_window(temp,"\n C-WINDOWS also contains a extensive  set  of  functions  for ");
  305.             print_window(temp,"\n handling  windows.  C-WINDOWS treats each seperate window as ");
  306.             print_window(temp,"\n a seperate virtual screen.  C-WINDOWS allows you to  scroll, ");
  307.             print_window(temp,"\n locate in,  color, blank, print in, move, open, close and re ");
  308.             print_window(temp,"\n activate each window by only specifying the window you  want \n");
  309.  
  310.  
  311.             locate_window(temp,18,15);
  312.             print_window(temp,"Press any key to continue...");
  313.             color_window(temp,foreground(14),0);
  314.             key=getch();
  315.             close_window(temp);
  316.  
  317.             break;
  318.         case(12):
  319.  
  320.             color(foreground(14),0);
  321.             temp=open_window(4,9,23,73);
  322.             color_window(temp,foreground(2),0);
  323.  
  324.             print_window(temp," this to take place in. \n");
  325.  
  326.             print_window(temp,"\n C-WINDOWS  has  a  default maximum setting of 255 windows at ");
  327.             print_window(temp,"\n one time.  This can be changed easily to a greater or lessor ");
  328.             print_window(temp,"\n amount by recompiling the source.  C-WINDOWS treats  windows ");
  329.             print_window(temp,"\n in  the same manor as the Macintosh and LISA computers.  You ");
  330.             print_window(temp,"\n can open windows in layers on top of  each  other  and  then ");
  331.             print_window(temp,"\n re-activate  a  window  which  is  in  the  middle of or the ");
  332.             print_window(temp,"\n bottom.  C-WINDOWS will restore any text under  the  windows ");
  333.             print_window(temp,"\n when they are opened, closed or re-activated.\n"); 
  334.  
  335.             print_window(temp,"\n To  use  the C-WINDOWS functions,  all you have to do is put ");
  336.             print_window(temp,"\n the code in your program which makes the call to the funtion ");
  337.             print_window(temp,"\n and then at link time specify the appropriate library.  Here ");
  338.             print_window(temp,"\n is a example of how this program 'demo.c' was  compiled  and ");
  339.             print_window(temp,"\n linked. \n");
  340.  
  341.  
  342.  
  343.             locate_window(temp,18,15);
  344.             print_window(temp,"Press any key to continue...");
  345.             color_window(temp,foreground(14),0);
  346.             key=getch();
  347.             close_window(temp);
  348.  
  349.             break;
  350.         case(11):
  351.  
  352.             color(foreground(14),0);
  353.             temp=open_window(4,9,23,73);
  354.             color_window(temp,foreground(2),0);
  355.  
  356.             print_window(temp,"            A>lc1 b:demo");
  357.             print_window(temp,"\n            A>lc2 b:demo");
  358.             print_window(temp,"\n            A>link a:cs+b:demo,demo,,b:windows+a:lcs\n");
  359.  
  360.             print_window(temp,"\n C-WINDOWS  was  written  using the LATTICE 2.12 'C' compiler ");
  361.             print_window(temp,"\n and IBM macro assembler ver 1.0.  For those who are familiar ");
  362.             print_window(temp,"\n with this compiler you can make sense out of the above.  For ");
  363.             print_window(temp,"\n those  who  are  not:  lc1 and lc2 are the two passes of the ");
  364.             print_window(temp,"\n compiler,  and when you link,  the file cs is a header  file ");
  365.             print_window(temp,"\n which   is   linked   to  your  'C'  program.   The  library ");
  366.             print_window(temp,"\n 'windows.lib'  must  be  specified  before  'lcs.lib'   (the ");
  367.             print_window(temp,"\n LATTICE   library)   because   'windows.lib'  contains  some ");
  368.             print_window(temp,"\n replacements for the LATTICE library. \n");
  369.  
  370.  
  371.              locate_window(temp,18,15);
  372.             print_window(temp,"Press any key to continue...");
  373.             color_window(temp,foreground(14),0);
  374.             key=getch();
  375.             close_window(temp);
  376.  
  377.             break;
  378.         case(10):
  379.  
  380.             color(foreground(14),0);
  381.             temp=open_window(4,9,23,73);
  382.             color_window(temp,foreground(2),0);
  383.  
  384.             print_window(temp," To give the support of color and full  screen  operation  to ");
  385.             print_window(temp,"\n standard  'C'  some changes had to be made to how the screen ");
  386.             print_window(temp,"\n is handled.  C-WINDOWS handles  color  and  cursor  location ");
  387.             print_window(temp,"\n similiar  to  that  of  IBM BASIC.  C-WINDOWS adds color and ");
  388.             print_window(temp,"\n cursor location support to the standard  printf()  function. "); 
  389.             print_window(temp,"\n Printf()  looks  at  the last color specified with a color() ");
  390.             print_window(temp,"\n function call and then prints using that color.  If no color ");
  391.             print_window(temp,"\n has been specified it uses the default setting of  white  on ");
  392.             print_window(temp,"\n black.  Printf()  was rewritten in assembly language to give ");
  393.             print_window(temp,"\n blazing speed increase and to support  color.  This  version ");
  394.             print_window(temp,"\n of  printf() is not compatable with the standard redirection ");
  395.             print_window(temp,"\n I/O supported by DOS,  but most  programs,  at  least  those ");
  396.             print_window(temp,"\n which are screen intensive,  never use this technique anyway ");
  397.             print_window(temp,"\n so there is on real loss. ");
  398.  
  399.  
  400.              locate_window(temp,18,15);
  401.             print_window(temp,"Press any key to continue...");
  402.             color_window(temp,foreground(14),0);
  403.             key=getch();
  404.             close_window(temp);
  405.  
  406.             break;
  407.         case(9):
  408.  
  409.             color(foreground(14),0);
  410.             temp=open_window(4,9,23,73);
  411.             color_window(temp,foreground(2),0);
  412.  
  413.             print_window(temp," The files provided with this package are:\n");
  414.  
  415.             print_window(temp,"\n             WINDOWS.LIB        |  The library of functions");
  416.             print_window(temp,"\n             WINDOWS.DOC        |  Documentation for each");
  417.             print_window(temp,"\n                                   fuction in the library");
  418.             print_window(temp,"\n             DEMO.EXE           |  This demonstration file");
  419.             print_window(temp,"\n             DEMO.C             |  The source to this demo");
  420.             print_window(temp,"\n                                   file, so you can see ");
  421.             print_window(temp,"\n                                   C-WINDOWS in use.\n");
  422.  
  423.             print_window(temp,"\n As mentioned earlier.  To obtain  the  source  to  C-WINDOWS ");
  424.             print_window(temp,"\n please send a contribution of $30 to: \n");
  425.  
  426.             print_window(temp,"\n                  Glen Boyd");
  427.             print_window(temp,"\n                  21606 Criptana");
  428.             print_window(temp,"\n                  Mission Veijo, CA 92692");
  429.  
  430.  
  431.             locate_window(temp,18,15);
  432.             print_window(temp,"Press any key to continue...");
  433.             color_window(temp,foreground(14),0);
  434.             key=getch();
  435.             close_window(temp);
  436.  
  437.             break;
  438.  
  439.         case(8):
  440.  
  441.             color(foreground(14),0);
  442.             temp=open_window(4,9,23,73);
  443.             color_window(temp,foreground(2),0);
  444.  
  445.             print_window(temp," When  you  send in a contribution I will send you a diskette ");
  446.             print_window(temp,"\n which contains the source and any new  revisions  to  the  C ");
  447.             print_window(temp,"\n WINDOWS  library,  any new functions which I have added to C ");
  448.             print_window(temp,"\n WINDOWS and documentation for  the  whole  package.  I  will ");
  449.             print_window(temp,"\n also  send  you any new programs which I have written.  Your ");
  450.             print_window(temp,"\n name will go on a mailing list and you will receive any news ");
  451.             print_window(temp,"\n about a new version or new programs which I have  available. "); 
  452.             print_window(temp,"\n You  will also receive a telephone # to call for support and ");
  453.             print_window(temp,"\n or questions about C-WINDOWS or any other related  questions ");
  454.             print_window(temp,"\n you might have. \n");
  455.  
  456.             print_window(temp,"\n This  demo  you  are watching is written entirely in 'C' and ");
  457.             print_window(temp,"\n uses the C-WINDOWS functions to do the  windows  and  screen ");
  458.             print_window(temp,"\n manipulation.  I  will take you through a tour of what these ");
  459.             print_window(temp,"\n functions are and how they can be used to write some  useful ");
  460.             print_window(temp,"\n applications. ");
  461.  
  462.             locate_window(temp,18,15);
  463.             print_window(temp,"Press any key to continue...");
  464.             color_window(temp,foreground(14),0);
  465.             key=getch();
  466.             close_window(temp);
  467.  
  468.             break;
  469.         case(7):
  470.  
  471.             color(foreground(14),0);
  472.             temp=open_window(4,9,23,73);
  473.             color_window(temp,foreground(2),0);
  474.  
  475.             print_window(temp," color()                   /* Allows setting of");
  476.             print_window(temp,"\n                              the default color */");
  477.             print_window(temp,"\n locate()                  /* Position cursor on");
  478.             print_window(temp,"\n                              the screen */");
  479.             print_window(temp,"\n place()                   /* Print single char */");
  480.             print_window(temp,"\n cls()                     /* Clear entire screen */");
  481.             print_window(temp,"\n v_bar()                   /* Print vertical bar of");
  482.             print_window(temp,"\n                              a specified char */");
  483.             print_window(temp,"\n h_bar()                   /* Print horizontial bar");
  484.             print_window(temp,"\n                              of a specified char */");
  485.             print_window(temp,"\n scroll()                  /* Scroll any part of the");
  486.             print_window(temp,"\n                              screen */");
  487.             print_window(temp,"\n printf()                  /* just like standard printf");
  488.             print_window(temp,"\n                              except written in assembly");
  489.             print_window(temp,"\n                              for speed and color */");
  490.  
  491.  
  492.             locate_window(temp,18,15);
  493.             print_window(temp,"Press any key to continue...");
  494.             color_window(temp,foreground(14),0);
  495.             key=getch();
  496.             close_window(temp);
  497.  
  498.             break;
  499.         case(6):
  500.  
  501.             color(foreground(14),0);
  502.             temp=open_window(4,9,23,73);
  503.             color_window(temp,foreground(2),0);
  504.             print_window(temp," box()                     /* Draws a box using double");
  505.             print_window(temp,"\n                              line drawing characters */");
  506.             print_window(temp,"\n minor_box( )              /* Draws a box using single");
  507.             print_window(temp,"\n                              line drawing characters */");
  508.             print_window(temp,"\n window()                  /* Makes an exploding box */");
  509.             print_window(temp,"\n save_restore()            /* Save and restore portions");
  510.             print_window(temp,"\n                              of the screen */\n");
  511.  
  512.             print_window(temp,"\n Are  functions  which operate with the screen no matter what ");
  513.             print_window(temp,"\n is on it.  These function can be used by themselves to write ");
  514.             print_window(temp,"\n your  own  window  or  screen   handling   routines.   These ");
  515.             print_window(temp,"\n functions  are  the  primitives used in the functions listed ");
  516.             print_window(temp,"\n below to  handle  the  windows.  Windows  are  handled  like ");
  517.             print_window(temp,"\n individual screens, for example if I open a window up, which ");
  518.             print_window(temp,"\n is  ten  rows  by  thirty columns then C-WINDOWS treats this ");
  519.             print_window(temp,"\n like a  seperate  screen.  You  can  scroll,  print,  color, ");
  520.  
  521.  
  522.  
  523.             locate_window(temp,18,15);
  524.             print_window(temp,"Press any key to continue...");
  525.             color_window(temp,foreground(14),0);
  526.             key=getch();
  527.             close_window(temp);
  528.  
  529.             break;
  530.  
  531.         case(5):
  532.  
  533.             color(foreground(14),0);
  534.             temp=open_window(4,9,23,73);
  535.             color_window(temp,foreground(2),0);
  536.  
  537.  
  538.             print_window(temp," locate the cursor, and do a host of other functions directly ");
  539.             print_window(temp,"\n to this virtual screen by just passing it a window #.  I can ");
  540.             print_window(temp,"\n have  up to 255 virtual screens open at the same time,  that ");
  541.             print_window(temp,"\n is if I have that much memory.  \n");
  542.  
  543.             print_window(temp,"\n activate()              /* Make a window active on");
  544.             print_window(temp,"\n                            the screen */");
  545.             print_window(temp,"\n open_window()           /* Open a window */");
  546.             print_window(temp,"\n close_window()          /* Close a previously opened");
  547.             print_window(temp,"\n                            window */");
  548.             print_window(temp,"\n scroll_window()         /* Scroll the text inside of");
  549.             print_window(temp,"\n                            a window */");
  550.             print_window(temp,"\n locate_window()         /* Locate the cursor inside");
  551.             print_window(temp,"\n                            of a window */");
  552.             print_window(temp,"\n print_window()          /* Allows printing in a");
  553.             print_window(temp,"\n                            specified window */");
  554.  
  555.  
  556.             locate_window(temp,18,15);
  557.             print_window(temp,"Press any key to continue...");
  558.             color_window(temp,foreground(14),0);
  559.  
  560.             key=getch();
  561.             close_window(temp);
  562.             break;
  563.         case(4):
  564.  
  565.             color_window(temp,foreground(2),0);
  566.  
  567.             temp=open_window(4,9,23,73);
  568.             color_window(temp,foreground(2),0);
  569.  
  570.             print_window(temp," cls_window()            /* Clears out a specified");
  571.             print_window(temp,"\n                            window */");
  572.             print_window(temp,"\n move_window()           /* Move a window around");
  573.             print_window(temp,"\n color_window()          /* Set color in a window */");
  574.             print_window(temp,"\n                            on the screen */\n");
  575.  
  576.             print_window(temp,"\n When a window is opened all text under the  window  will  be ");
  577.             print_window(temp,"\n saved,  then the window will open up using the current color ");
  578.             print_window(temp,"\n specified with the last  color()  function  call,  then  the ");
  579.             print_window(temp,"\n virtual  screen  (the  inside of the window) will be cleared ");
  580.             print_window(temp,"\n and the cursor will locate in the HOME postion (row 1 column ");
  581.             print_window(temp,"\n 1).  Any printing,  locating,  and  coloring  that  is  done ");
  582.             print_window(temp,"\n inside  this  window  will  be relative to its HOME postion. "); 
  583.             print_window(temp,"\n C-WINDOWS allows overlapping windows, which can be opened on ");
  584.             print_window(temp,"\n top of each other.  When a  window  is  opened,  it  is  the \n");
  585.  
  586.  
  587.  
  588.             locate_window(temp,18,15);
  589.             print_window(temp,"Press any key to continue...");
  590.             color_window(temp,foreground(14),0);
  591.  
  592.             key=getch();
  593.             close_window(temp);
  594.  
  595.             break;
  596.  
  597.         case(3):
  598.  
  599.             color(foreground(14),0);
  600.             temp=open_window(4,9,23,73);
  601.             color_window(temp,foreground(2),0);
  602.  
  603.  
  604.             print_window(temp," current (active) window,  that is, it is the window which is ");
  605.             print_window(temp,"\n on top.  When another window is opened it becomes the active ");
  606.             print_window(temp,"\n window  and  the  previous  window  becomes  inactive.  This ");
  607.             print_window(temp,"\n mechanism  allows  for  windows  to be layered on top of one ");
  608.             print_window(temp,"\n another.  You can do anything to any window at any  time  by ");
  609.             print_window(temp,"\n just  specifying  the window #,  and C-WINDOWS will sort out ");
  610.             print_window(temp,"\n what is to be done to  whom.  For  example  if  I  have  ten ");
  611.             print_window(temp,"\n windows  opened up and I want to print to the third one then ");
  612.             print_window(temp,"\n I  would  call  the  print_window()  fucntion  passing   the ");
  613.             print_window(temp,"\n appropriate  window  #  and  data  to  be  printed in it.  C ");
  614.             print_window(temp,"\n WINDOWS will make it the activate window,  by bringing it to ");
  615.             print_window(temp,"\n the top and then printing in it. \n");
  616.  
  617.             print_window(temp,"\n I  am  going  to  take  you through a short demonstration of ");
  618.             print_window(temp,"\n opening windows and printing to them.  This  demo  will  use ");
  619.             print_window(temp,"\n four windows which are opened,  closed,  activated,  printed ");
  620.  
  621.             locate_window(temp,18,15);
  622.             print_window(temp,"Press any key to continue...");
  623.             color_window(temp,foreground(14),0);
  624.  
  625.             key=getch();
  626.             close_window(temp);
  627.  
  628.             break;
  629.         case(2):
  630.  
  631.             color(foreground(14),0);
  632.             temp=open_window(4,9,23,73);
  633.             color_window(temp,foreground(2),0);
  634.  
  635.             print_window(temp," in,  move around,  cleared,  and scrolled text in.  First we ");
  636.             print_window(temp,"\n will  start  off  by  opening  a window in ten rows tall and ");
  637.             print_window(temp,"\n thirty five columns wide.  We will position this  window  in ");
  638.             print_window(temp,"\n our  upper left corner of this window.  The function call to ");
  639.             print_window(temp,"\n do this looks like this. \n");
  640.  
  641.             print_window(temp,"\n            wind1=open_window(7,14,18,50);\n");
  642.  
  643.             print_window(temp,"\n Ok,  lets examine this statement  before  we  do  the  call. ");
  644.             print_window(temp,"\n First  of  all  the  function  open_window()  will  return a ");
  645.             print_window(temp,"\n integer which is a window ID #,  this # is  a  ID  which  is ");
  646.             print_window(temp,"\n assigned  when  the  window  is  opened.  This  ID  does not ");
  647.             print_window(temp,"\n represent the coresponding place which it  was  opened,  but ");
  648.             print_window(temp,"\n represents  a  ID  given  to  that  window.  Each  window is ");
  649.             print_window(temp,"\n assigned an unique ID number which is used in identifying it ");
  650.  
  651.  
  652.             locate_window(temp,18,15);
  653.             print_window(temp,"Press any key to continue...");
  654.             color_window(temp,foreground(14),0);
  655.  
  656.             key=getch();
  657.             close_window(temp);
  658.  
  659.             break;
  660.         case(1):
  661.  
  662.             color(foreground(14),0);
  663.             temp=open_window(4,9,23,73);
  664.             color_window(temp,foreground(2),0);
  665.             print_window(temp," with the rest of the windows.  Ok,  the firt argument in the ");
  666.             print_window(temp,"\n function call is the row which the upper left hand corner of ");
  667.             print_window(temp,"\n the window will be placed in,  the next is the column of the ");
  668.             print_window(temp,"\n upper left hand corner, the next two arguments are the lower ");
  669.             print_window(temp,"\n left  hand  corners  row  and  column.   Well  now  that  we ");
  670.             print_window(temp,"\n understand that lets do the call. \n\n");
  671.  
  672.             locate_window(temp,18,15);
  673.             print_window(temp,"Press any key to continue...");
  674.             color_window(temp,foreground(14),0);
  675.  
  676.             key=getch();
  677.  
  678.             color(foreground(1),0);
  679.  
  680.         wind1=open_window(7,14,18,50);
  681.  
  682.  
  683. /*  do the open  */
  684.  
  685.             print_window(wind1," Now you can see  we  are  inside");
  686.             print_window(wind1,"\n this   window   and  it  is  the ");
  687.             print_window(wind1,"\n current active window.  Now lets ");
  688.             print_window(wind1,"\n open up some more windows so  we ");
  689.             print_window(wind1,"\n can see some more. ");
  690.             print_window(wind1,"\n Press any key when ready..");
  691.             key=getch();
  692.  
  693.             color(foreground(4),0);
  694.  
  695.  
  696.         wind2=open_window(1,23,12,60);    
  697.  
  698. /* open up another window */
  699.  
  700.               print_window(wind2," This is our second window");
  701.             print_window(wind2,"\n\n Press any key when ready..");
  702.             key=getch();
  703.  
  704.             color(foreground(15),0);
  705.  
  706.  
  707.         wind3=open_window(9,43,20,80);
  708.  
  709.  
  710.             print_window(wind3," This is our third window");
  711.             print_window(wind3,"\n\n Press any key when ready..");
  712.             key=getch();
  713.  
  714.  
  715.             color(foreground(10),0);
  716.  
  717.         wind4=open_window(14,1,25,37);
  718.  
  719. /* open up another window */
  720.  
  721.             print_window(wind4," This  is  our   fourth   window. ");
  722.             print_window(wind4,"\n Notice   that  I  specified  the ");
  723.             print_window(wind4,"\n window    locations     in     a ");
  724.             print_window(wind4,"\n overlapping    fashion.     Each ");
  725.             print_window(wind4,"\n window  is  placed  some   where ");
  726.             print_window(wind4,"\n overlapping   the   one   under- ");
  727.             print_window(wind4,"\n neath.  Now that we  have  these ");
  728.             print_window(wind4,"\n windows  open we can call up any ");
  729.             print_window(wind4,"\n window at any  time.  Lets  call ");
  730.             print_window(wind4,"\n window two. Press any key... ");
  731.  
  732.             key=getch();
  733.  
  734.  
  735. /* Now activate window two */
  736.  
  737.             cls_window(wind2);
  738.             print_window(wind2," Notice how this  window  becomes ");
  739.             print_window(wind2,"\n active   restoring   all   stuff ");
  740.             print_window(wind2,"\n underneath  it  and     anything ");
  741.             print_window(wind2,"\n inside    the    window.    Lets ");
  742.             print_window(wind2,"\n demonstrate  some  other  things ");
  743.             print_window(wind2,"\n C-WINDOWS  can  do.   Lets  move ");
  744.             print_window(wind2,"\n this window  to  the  right  ten ");
  745.             print_window(wind2,"\n spaces.  Press any key ten times ");
  746.  
  747.  
  748.             for(i=0;i<10;i++){
  749.  
  750.                 key=getch();
  751.                 move_window(wind2,2);
  752.             }
  753.                 
  754.             key=getch();
  755.  
  756.  
  757. /* do the move */
  758.  
  759.             cls_window(wind2);
  760.  
  761.             print_window(wind2," I am going  to  demonstrate  the ");
  762.             print_window(wind2,"\n scrolling capabilities  of  each ");
  763.             print_window(wind2,"\n window.\n\n   Press any key when ");
  764.             print_window(wind2,"ready... ");
  765.  
  766.             key=getch();
  767.  
  768.  
  769. /* Do scrolling on each window */
  770.  
  771.             cls_window(wind1);
  772.  
  773.             for(j=1;j<=25;j++){
  774.  
  775.                 sprintf(string," This is scrolling up %d\n",j);
  776.                 print_window(wind1,string);
  777.             
  778.             }
  779.  
  780.             cls_window(wind4);
  781.  
  782.             for(j=1;j<=25;j++){
  783.  
  784.                 sprintf(string," This is scrolling up %d\n",j);
  785.                 print_window(wind4,string);
  786.             
  787.             }
  788.             for(j=25;j>=10;j--){
  789.  
  790.                 scroll_window(wind4,1,1);
  791.                 locate_window(wind4,1,1);
  792.                 sprintf(string,"  This is a scrolling down %d",j-9);
  793.                 print_window(wind4,string);
  794.             
  795.             }
  796.  
  797.             locate_window(wind4,10,1);
  798.             print_window(wind4,"\n Press any key to continue...");
  799.             key=getch();
  800.  
  801.  
  802. /* open window 1 and */
  803.  
  804. /* clear window one */
  805.             cls_window(wind1);
  806.  
  807.             print_window(wind1," Now we are back  to  window  one ");
  808.             print_window(wind1,"\n and you can start to see some of ");
  809.             print_window(wind1,"\n the power we have by just having ");
  810.             print_window(wind1,"\n four windows, and you have up to ");
  811.             print_window(wind1,"\n 255! \n");
  812.  
  813.             print_window(wind1,"\n Press any key when ready...");
  814.             key=getch();
  815.             close_window(wind1);
  816. /* close window one */
  817.  
  818.             cls_window(wind3);
  819.  
  820. /* clear window 3 */
  821.             print_window(wind3,"\n Now lets close them all\n");
  822.  
  823.             print_window(wind3,"\n Press any key when ready...");
  824.             key=getch();
  825.  
  826.             close_window(wind3);
  827. /* close window 3 */
  828.             cls_window(wind4);
  829.  
  830. /* clear window 4 */
  831.             print_window(wind4," Now lets close window 4");
  832.  
  833.             print_window(wind4,"\n Press any key when ready...");
  834.             key=getch();
  835.  
  836.             close_window(wind4);
  837. /* close window 4 */
  838.             cls_window(wind2);
  839. /* clear window 2 */
  840.  
  841.             print_window(wind2," This  is  the  last  one so here ");
  842.             print_window(wind2,"\n goes.  Watch  how  the  previous ");
  843.             print_window(wind2,"\n window,  which  is the one below ");
  844.             print_window(wind2,"\n becomes active as we  close  all ");
  845.             print_window(wind2,"\n the windows on top of it. ");
  846.  
  847.             print_window(wind2,"\n Press any key when ready...");
  848.  
  849.             key=getch();
  850.  
  851.             close_window(wind2);
  852.  
  853. /* close window 2 */
  854.  
  855.             cls_window(temp);
  856.  
  857.             color_window(temp,foreground(2),0);
  858.             print_window(temp,"\n We made it back here and thats all folks...");
  859.             print_window(temp,"\n Thank you and have fun, writting applications.");
  860.  
  861.             locate_window(temp,18,15);
  862.             print_window(temp,"Press any key to continue...");
  863.  
  864.             key=getch();
  865.             close_window(temp);
  866.  
  867.             break;
  868.         case(0):
  869.  
  870.             color(foreground(14),0);
  871.             temp=open_window(4,9,23,73);
  872.             color_window(temp,foreground(2),0);
  873.  
  874.             print_window(temp," To get the latest copy of this program or to leave a");
  875.             print_window(temp,"\n message for me, you can call");
  876.             print_window(temp,"\n\n                   The Consultants Exchange");
  877.             print_window(temp,"\n                   714-842-6348");
  878.             print_window(temp,"\n                   Huntington Beach, CA");
  879.             print_window(temp,"\n\n And leave a message on it for Glen Boyd");
  880.             print_window(temp,"\n This is a Electronic BBS.  You must have a");
  881.             print_window(temp,"\n modem to call this number.");
  882.  
  883.             locate_window(temp,18,15);
  884.             print_window(temp,"Press any key to continue...");
  885.             color_window(temp,foreground(14),0);
  886.  
  887.             key=getch();
  888.             close_window(temp);
  889.  
  890.             break;
  891.  
  892.         case(-2):
  893.  
  894.             close_window(temp2);
  895.  
  896.             break;
  897.  
  898.     }
  899.  
  900. }
  901.  
  902. slow()
  903. {
  904.  
  905.     int    i;
  906.     for(i=0;i<=5000;i++);
  907.  
  908. }
  909.  
  910. slower()
  911.  
  912. {
  913.  
  914.     int    i;
  915.  
  916.     for(i=0;i<=350;i++);
  917.  
  918. }
  919.  
  920. 
  921.  
  922.     for(i=0;i<=350;i++);
  923.  
  924. }
  925.  
  926.